put "Select the object to make into a PICT..." into cd fld "Comment"
put Ants() into theRect
if theRect is empty then
put empty into cd fld "Comment"
show me
exit mouseUp
end if
put empty into cd fld "Comment"
choose select tool
drag from item 1 of theRect,item 2 of theRect to item 3 of theRect,item 4 of theRect -- with optionKey
doMenu "Copy Picture"
choose browse tool
ShowDialog 2,5740,"Please assign a unique ID and name to your PICT resource...","","",""
if the result is empty then
show me
exit mouseUp
end if
put the result into temp
if item 1 of temp is empty then
put 0 into theID
else put item 1 of temp into theID
put item 2 of temp into theName
ClipToPICT theID,theName
if word 1 of the result = "Error:" then
put the result into cd fld "Comment"
show me
exit mouseUp
end if
put "The new PICT resource is ID" && the result into cd fld "Comment"
show me
end mouseUp
-- part 2 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=4 top=260 right=280 bottom=504
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Comment
-- part 3 (button)
-- low flags: 00
-- high flags: 2000
-- rect: left=320 top=30 right=55 bottom=350
-- title width / last selected line: 0
-- icon id / first selected line: 25002 / 25002
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Huh?
----- HyperTalk script -----
on mouseUp
lock screen
if the visible of cd fld "Info" then
hide cd fld "Info"
set scroll of cd fld "Info" to 0
unlock screen with zoom in
else
put empty into cd fld "Comment"
show cd fld "Info"
unlock screen with zoom out
end if
end mouseUp
-- part 4 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=53 top=72 right=258 bottom=443
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Info
----- HyperTalk script -----
on mouseUp
lock screen
hide cd fld "Info"
set scroll of cd fld "Info" to 0
unlock screen with zoom in
end mouseUp
-- part contents for background part 2
----- text -----
PICT Maker
-- part contents for card part 4
----- text -----
HyperCard itself is an excellent painting application. So if you prefer, prepare your artwork on this card and click the "Make PICT Resource" button. Your artwork will be converted into a PICT resource and saved into this stack. If you want to make color PICTs or use the paint/draw method as described on a previous card you'll still have to use ResEdit.
PICT Maker uses an XFCN called Ants that returns the coordinates of a rectangle drawn out with the mouse and an XMCD called ClipToPICT to copy whatever picture is on the clipboard into a PICT resource and place it in the current stack.
The arguments of ClipToPICT XCMD are:
ClipToPICT <new PICT resource ID>,<new PICT name>
where
<new PICT resource ID> is the resource ID number for the new PICT;
<new PICT name> is the name of the new PICT resource.
If you pass "0" (that's a zero) as the first parameter, ClipToPICT will assign its own unique ID to the new resource.
If you leave the second parameter empty (that doesn't mean that you can OMIT the second parameter) then the new PICT will be unnamed.
If everything goes alright the ID of the new PICT resource will be returned in "the result." If something goes wrong the following errors are returned in the result:
Error: You must provide 2 parameters (PICT ID and name)!
Error: That PICT resource ID already exists!
Error: That PICT name already exists!
Error: There isn't a picture on the clipboard!
Error: Unable to open the stack!
Any disk related errors will be reported by
Error: <OSError>
where <OSError> is one of the standard Macintosh operating system error codes. The ones that you potentially will encounter with ClipToPICT are:
-34: disk full
-44: disk locked
-61: file locked
As you can deduce from the error messages, ClipToPICT will not write over a previously existing PICT resource if it has the same ID or name as the new one. If there isn't anything on the clipboard (or there is text), ClipToPICT will exit without creating a resource.
Ants XFCN 1.0 and
ClipToPICT XCMD 1.1 are Copyright© 1988 by Jay Hodgdon